<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>返回数组第二大的值</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<script type="text/javascript">
    function sec(arr) {
        for(var i=0; i<arr.length; i++) {
            for(var j=i+1; j<arr.length; j++) {
                if(arr[i] < arr[j]) {
                    var temp = arr[i];
                    arr[i] = arr[j];
                    arr[j] = temp;
                }
            }
        }
        return arr[1];
    }
    var arr = ['12','32','42','39','19','27','30','26'];
    var res = sec(arr);
    document.write('第二大的数值为：' + res);
</script>

<style type="text/css">
</style>
</head>
    <body>
    </body>
</html>